<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="<?=POWERED?>" /> 
<meta name="Copyright" content="<?=COPYRIGHT?>" /> 
<meta name="generator" content="<?=SOFTWARE?> <?=VERSION?>" />
<title><?=lang('system.admin.index.title')?></title>
<link rel="stylesheet" rev="stylesheet" href="images/admincp/index.css" type="text/css" media="all" />
<?php if(false) {?>
<link rel="stylesheet" rev="stylesheet" href="../../../images/admincp/index.css" type="text/css" media="all" />
<?php }?>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
</head>
<body scroll="no">
    <div id="tools">
        <?=lang('hi')?>,<?=$_SESSION['user_name']?> [<a href="<?=UE_Url::make('user/account/logout')?>"><?=lang('logout')?></a>] 
        <a href="./" target="_blank"><?=lang('system.admin.index.frontpage')?></a>
        <a href="<?=UE_Url::make('system/admin/index')?>">后台首页</a>
    </div>
    <table id="index-wrap" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
          <td height="90" align="left" colspan="3" id="ui-td-header">
              <div id="header">
                  <div id="logo" onclick="window.location='<?=UE_Url::make('system/admin/index')?>'"><?=lang('system.admin.index.name')?></div>
                  <div id="nav">
                      <ul id="top_nav">
                          <?php foreach($menu as $mk => $imenu):if($imenu['isTop']):?><li class="ui-button-text" onclick="showSideMenu(<?=$mk?>)"><?=$imenu['menu_name']?></li><?php endif; endforeach;?>
                      </ul>
                  </div>
              </div>
          </td>
      </tr>
      <tr>
        <td id="left" width="160" align="left" valign="top">
          <ul id="left_menu">
          </ul>
        </td>
        <td width="10" align="center" valign="middle" id="side-switch">
            <img src="images/admincp/arrow_left.gif" width="10" />
        </td>
        <td align="left" valign="top">
          <iframe id="admin-main" name="admin-main" frameborder="0" height="100%" width="100%" scrolling="yes">&nbsp;</iframe>
        </td>
      </tr>
    </table>
<div id="copyright">
    Powered by <a href="http://www.ueshop.cn" target="_blank"><font color="#005D39" title=""><b>UEShop</b> 1.0</font></a>
</div>
<script type="text/javascript">
//<![CDATA[
var menuJson = <?=$menuJson?>;

function showSideMenu(menuId) {
	var menuHtml = '';
	var chile = menuJson[menuId]['chile'];
	if(chile.length <= 0) {return ;}
	for(var i in chile) {
		if(chile[i] == menuId) continue;
		var iNode = menuJson[chile[i]];
		menuHtml += '<li><label class="menu-node-name menu-node-on" id="menu-node-name-'+chile[i]+'">'+iNode['menu_name']+'</label>';
		
		menuHtml += '<ul id="menu-node-list-'+chile[i]+'" class="menu-node-list">';		
		var iChile = iNode['chile'];		
		for(var j in iChile) {
			if(iChile[j] == chile[i]) continue;
			var jNode = menuJson[iChile[j]];
			menuHtml += '<li><label class="" id="menu-node-name-'+iChile[j]+'"><a href="'+jNode['menu_url']+'" target="admin-main">'+jNode['menu_name']+'</a></label></li>';
		}
		menuHtml += '</ul></li>';
	}
	$('#left_menu').html(menuHtml);
	$('#left_menu li li a').click(function(){$('#left_menu li li a.current').removeClass('current'); $(this).addClass('current')});
	
}

function openMenu(menuId) {
	$('.menu-node-on').removeClass('menu-node-on');
	$('#menu-node-name-'+menuId).addClass('menu-node-on');
	$('.menu-node-list').hide();
	$('#menu-node-list-'+menuId).show();
}
$(function(){
	$('#ui-loading', parent.document).remove();
	$('body').ajaxStart(function(){
		$('body', parent.document).append('<div id="ui-loading">&nbsp;</div>');
	});
	$('body').ajaxComplete(function(){
		$('#ui-loading', parent.document).remove();
	});

    $('.ui-buttonset label, .ui-button').hover(
		function() { $(this).addClass('ui-state-hover'); }, 
		function() { $(this).removeClass('ui-state-hover'); }
	);
	
	$('#admin-main').height($(window).height()-$('#header').height() - 5);
	$(window).resize(function(){$('#admin-main').height($(window).height()-$('#header').height() - 5);});
	
	// 打开侧栏
	$('#side-switch img').click(function() {sideToggle();});
	
	showSideMenu(2);
	openTag('index', '<?=UE_Url::make('system/admin/welcome')?>');
});

function sideToggle() {
	var osrc = 'images/admincp/arrow_right.gif';
	var csrc = 'images/admincp/arrow_left.gif';
	if($('#left').hasClass('ui-close')) {
		$('#left').removeClass('ui-close');
		$('#side-switch img').attr('src', csrc);
	} else {
		$('#left').addClass('ui-close');
		$('#side-switch img').attr('src', osrc);
		
	}
}


function openTag(id, url) {
	$('#admin-main').attr('src', url);
	$('#menu-node-name-'+id).click();
}
function appsListClose() {
    $("#apps_list_menu").fadeOut("slow",function(){
        $(this).remove();
    });
}

//]]>
</script>

</body>
</html>
